﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_ArticleManager : System.Web.UI.Page
{
    UserHelper u = new UserHelper();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            AspNetPager1.RecordCount = u.GetTopicC();
            bindData();
        }
    }
    public void bindData()
    {
        Repeater1.DataSource = u.GetTopicInfo(AspNetPager1.StartRecordIndex,AspNetPager1.EndRecordIndex);
        Repeater1.DataBind();
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Literal li = (Literal)e.Item.FindControl("textClass");
            li.Text = u.GetTopicClass(Convert.ToInt32(li.Text));
            Literal licon = (Literal)e.Item.FindControl("textContent");
            string temp = licon.Text = FormatText.RemoveHTML(licon.Text);
            if (temp.Length > 20)
            {
                licon.Text = temp.Substring(0, 20) + "……";
            }
        }
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        bindData();
    }
}